var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "maishu-jueying", "controls/spiner-component", "mobile/services/localService", "mobile/site", "services/page-datas"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    const maishu_jueying_1 = require("maishu-jueying");
    const spiner_component_1 = require("controls/spiner-component");
    const localService_1 = require("mobile/services/localService");
    const site_1 = require("mobile/site");
    const page_datas_1 = require("services/page-datas");
    class HomeIndexPage extends spiner_component_1.SpinerComponent {
        constructor(props) {
            super(props);
            this.localSevice = this.props.createService(localService_1.LocalService);
        }
        loadData() {
            return __awaiter(this, void 0, void 0, function* () {
                let record = yield page_datas_1.pageDatas.home();
                let pageData = record.pageData;
                yield site_1.loadComponents(pageData);
                return { pageData };
                // return new Promise(() => {
                // });
            });
        }
        render() {
            console.assert(this.state != null);
            let { pageData } = this.state;
            let r = maishu_jueying_1.Component.createElement(pageData);
            return r;
        }
    }
    exports.default = HomeIndexPage;
});
